package cn.sirun.com.fca.account.view.impl;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.tencent.cloud.iov.common.flow.view.impl.BaseLoadingFlowView;
import com.tencent.cloud.iov.flow.presenter.IPresenter;
import com.tencent.cloud.iov.flow.view.IContentViewContainer;
import com.tencent.cloud.iov.router.Router;
import com.tencent.cloud.iov.util.ActivityUtils;
import com.tencent.cloud.iov.util.ResourcesUtils;
import com.tencent.cloud.uikit.utils.SystemUiUtils;

import cn.sirun.com.fca.account.R;
import cn.sirun.com.fca.account.constant.AccountActivityConst;

public class UserAgreementFlowView extends BaseLoadingFlowView {
    private TextView mNoAgreeTV, mAgreeTV;

    public UserAgreementFlowView(Activity activity) {
        super(activity);
    }

    public UserAgreementFlowView(Activity activity, IContentViewContainer container) {
        super(activity, container);
    }

    @Override
    protected IPresenter createPresenter() {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        setUpActionBar();
        initView();
    }

    private void setUpActionBar() {
        final Activity activity = getActivity();
        SystemUiUtils.showActionBar(
                activity, ResourcesUtils.getString(R.string.user_agreement),
                ResourcesUtils.getDrawable(R.color.white));
    }

    private void initView() {
        setContentView(R.layout.user_agreement_activity);
        final Activity activity = getActivity();
        Intent intent = getActivity().getIntent();
        final String dinCode = intent.getStringExtra("din");

        mNoAgreeTV = activity.findViewById(R.id.tv_no_agree);
        mAgreeTV = activity.findViewById(R.id.tv_agree);

        mNoAgreeTV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                activity.finish();
            }
        });

        mAgreeTV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                Intent intent = Router.fromPath(AccountActivityConst.Path.COMPANY_AUTH_CAR);
//                ActivityUtils.startActivity(activity, intent);
                Intent intent = Router.fromPath(AccountActivityConst.Path.AUTHENTICATION);
                intent.putExtra("din",dinCode);
                ActivityUtils.startActivity(activity, intent);
            }
        });
    }

}
